<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../../base.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>数据 - AdminLTE2定制版</title>
</head>
<body>
    <div id="frameContent" class="content-wrapper" style="margin-left:0px;">
        <section class="content-header">
            <h1>
                产品信息
                <small>产品管理</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="${ctx}/home/main.do"><i class="fa fa-dashboard"></i> 首页</a></li>
            </ol>
        </section>
        <section class="content">
            <div class="box-body">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active">
                            <a href="#tab-form" data-toggle="tab">产品编辑</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <form id="editForm" action="/cargo/factoryProduct/edit.do" method="post" enctype="multipart/form-data">
                            <input type="hidden" name="id" value="${product.id}">
                            <div class="tab-pane active" id="tab-form">
                                <div class="row data-type">
                                    <div class="col-md-2 title">编号</div>
                                    <div class="col-md-10 data">
                                        <input type="text" class="form-control" placeholder="编号" name="productNo" value="${product.productNo}">
                                    </div>
                                    <div class="col-md-2 title">照片</div>
                                    <div class="col-md-10 data">
                                        <input type="file" class="form-control" placeholder="请选择" name="productPhoto">
                                    </div>
                                    <div class="col-md-2 title">描述</div>
                                    <div class="col-md-10 data">
                                        <input type="text" class="form-control" placeholder="描述" name="description" value="${product.description}">
                                    </div>
                                    <div class="col-md-2 title">生产厂家</div>
                                    <div class="col-md-10 data">
                                        <select class="form-control" name="factoryId" id="factoryInfo" onchange="document.getElementById('factoryName').value=this.options[this.selectedIndex].text">
                                            <option value="">请选择</option>
                                            <c:forEach items="${factoryList}" var="factory">
                                                <option value="${factory.id}" ${product.factoryId eq factory.id ? "selected" : ""}>
                                                        ${factory.factoryName}
                                                </option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <div class="col-md-2 title">价格</div>
                                    <div class="col-md-10 data">
                                        <input type="text" class="form-control" placeholder="价格" name="price" value="${product.price}">
                                    </div>
                                    <div class="col-md-2 title">数量</div>
                                    <div class="col-md-10 data">
                                        <input type="text" class="form-control" placeholder="数量" name="qty" value="${product.qty}">
                                    </div>
                                    <div class="col-md-2 title">体积</div>
                                    <div class="col-md-10 data">
                                        <input type="text" class="form-control" placeholder="体积" name="cbm" value="${product.cbm}">
                                    </div>

                                    <div class="col-md-2 title">颜色</div>
                                    <div class="col-md-10 data">
                                        <input type="text" class="form-control" placeholder="颜色" name="color" value="${product.color}">
                                    </div>
                                    <div class="col-md-2 title">备注</div>
                                    <div class="col-md-10 data">
                                        <input type="text" class="form-control" placeholder="备注" name="remark" value="${product.remark}">
                                    </div>
                                    <div class="col-md-2 title"></div>
                                    <div class="col-md-10 data text-center">
                                        <button type="button" onclick='document.getElementById("editForm").submit()'  class="btn bg-maroon">保存</button>
                                        <button type="button" class="btn bg-default" onclick="history.back(-1);">返回</button>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>

        </section>
    </div>
</body>

</html>